<?php

namespace bc\model;

use bc\ar\MActiveRecord;

class ExpressModel extends MActiveRecord{

	function __construct(){
		parent::__construct();
		$this->autoId='express_id';
	}

	/**
	 * 定义数据表
	 */
	public static function tableName()
	{
		return '{{%express}}';
	}

	public function getSendinfo($params)
	{
		$ar = $this->find ()->select($this->columns)
			->leftJoin('bc_express_company', 'bc_express_company.company_id = bc_express.company_id')
			->where($params);

		if($this->sort == null)
			$ar->orderBy ( $this->autoId . ' DESC' );
		else
			$ar->orderBy ( $this->sort );
//		echo $ar->createCommand()->getRawSql();
		return $ar->asArray()->all();
	}
}